﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Treely.Data.Repositories
{
    public abstract class Repository : IDisposable
    {
        protected ApplicationDbContext Context { get; set; }

        protected Repository()
        {
            Context = new ApplicationDbContext();
        }

        public Repository(ApplicationDbContext context)
        {
            Context = context;
        }

        public void Dispose()
        {
            Context.Dispose();
        }

        public void Dispose(bool disposing)
        {
            if (disposing)
                Dispose();
        }
    }
}